<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <title>用户列表</title>

    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <link rel="stylesheet" th:href="@{lib/css/main.css}">
    <link rel="stylesheet" th:href="@{/lib/css/public.css}">

    <script th:src="@{/lib/js/jquery-3.4.1.min.js}"></script>
    <script th:src="@{/layui/layui.js}"></script>
    <!--<script th:src="@{/lib/js/allclass.js}"></script>-->



</head>




<body>

<div class="table">
    <h2 class="tablename">评论</h2>
    <hr class="layui-bg-gray">
    <table class="layui-hide" id="demo" lay-filter="test"></table>

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <!--<div class="layui-card-body ">-->
                        <!--<div class="layui-inline layui-show-xs-block">-->
                            <!--<input type="text" id="value"  autocomplete="off" class="layui-input">-->
                        <!--</div>-->
                        <!--<button id="ping" onclick="pinglun()">评论</button>-->

                        <table class="layui-table layui-form">
                            <tr>
                                <td>用户</td>
                                <td>评论</td>
                            </tr>
                            <div th:each="j:${list}">
                                <tr>
                                    <td th:text="${j.user.userName}"></td>
                                    <td th:text="${j.pinglun}">aaa</td>
                                </tr>
                            </div>
                        </table>
                        <!--<div class="layui-inline layui-show-xs-block">-->
                        <!--<button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>-->
                        <!--</div>-->
                        <!--</form>-->
                    </div>
                    <!--<a href="/orderlist">返回</a>-->
                    <div class="layui-card-body ">

                    </div>
                    <div class="layui-card-body ">
                        <div class="page">
                            <div>
                                <a class="prev" href="">&lt;&lt;</a>
                                <a class="num" href="">1</a>
                                <span class="current">2</span>
                                <a class="num" href="">3</a>
                                <a class="num" href="">489</a>
                                <a class="next" href="">&gt;&gt;</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>


    // $(document).ready(function(){
    //     var role = [[${role}]]
    //     if(role == 2){
    //         $("#value").hide()
    //         $("#ping").hide()
    //     }
    //
    // });


    function pinglun(){

        var orderId = [[${orderId}]]
        var value = $("#value").val()

        if(value == null || value == ''){
            alert("请输入评论呀亲！")
            return false;
        }

        $.ajax({
            url:"/addcritic",
            type:"POST",
            data:{"orderId":orderId,"pinglun":value},
            success:function(data){
                if(data == 1){
                    alert("评论成功！")
                    //刷新页面
                    window.location.reload();

                }

            },
            error:function(){
                alert("系统内部出现问题，请联系工作人员！")
            }
        })
    }
</script>


</body>

</html>